package com.som.beanconvert.data3.output;

import java.util.Map;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.ss.usermodel.Row;

import com.som.bean.data3.IpAddressInfo;
import com.som.beanconvert.ExcelColumnProcessInf;
import com.som.beanconvert.ExcelDataParseOutputInf;

/**
 * 格式1：IP, 信息(sheet页的名称为IP)
 * 
 * @author liujun
 * @date 2016年4月8日
 * @verion 0.0.1
 */
public class IpAddressInfoExcelOutput extends IpAddressInfo implements ExcelDataParseOutputInf<IpAddressInfo>, ExcelColumnProcessInf
{

	public void setExcelColumn(Map<String, String> column, Row row)
	{
		HSSFRow hrow = (HSSFRow) row;

		// 设置ip信息
		HSSFCell cellIp = hrow.createCell(0);
		cellIp.setCellType(HSSFCell.CELL_TYPE_STRING);
		cellIp.setCellValue("IP");

		// 设置输出信息
		HSSFCell cellMsg = hrow.createCell(1);
		cellMsg.setCellType(HSSFCell.CELL_TYPE_STRING);
		cellMsg.setCellValue("Message");

	}

	public void parseExcelRow(IpAddressInfo beaninfo, Row row)
	{
		HSSFRow hrow = (HSSFRow) row;

		// 设置ip
		HSSFCell cellIp = hrow.createCell(0);
		cellIp.setCellType(HSSFCell.CELL_TYPE_STRING);
		cellIp.setCellValue(beaninfo.getIpaddress());

		// 设置输出信息
		HSSFCell cellMsg = hrow.createCell(1);
		cellMsg.setCellType(HSSFCell.CELL_TYPE_STRING);
		cellMsg.setCellValue(beaninfo.getMsginfo());
	}

}
